/**
 * Created by xing on 2017/4/10.
 */
//Fibonacci的尾递归实现
function Fibonacci(n){
    return fib(1,0,n);
    function fib(a,b,count){
        if(count===0)return b;
        return fib(a+b,a,--count);
    }
}

console.log(Fibonacci(0));
console.log(Fibonacci(1));
console.log(Fibonacci(2));
console.log(Fibonacci(3));
console.log(Fibonacci(4));
console.log(Fibonacci(5));
console.log(Fibonacci(6));